home *** CD-ROM | disk | FTP | other *** search
/ Aminet 16 / Aminet 16 (1996)(GTI - Schatztruhe)[!][Dec 1996].iso / Aminet / comm / bbs / TA1_22.lha / Programming / trans_lib.doc < prev    next >
Text File  |  1992-03-19  |  20KB  |  588 lines

  1. TABLE OF CONTENTS
  2.  
  3. transamiga.library/ANSIWrite
  4. transamiga.library/BBSCmd
  5. transamiga.library/BBSLineInfo
  6. transamiga.library/CheckCarrier
  7. transamiga.library/CheckLock
  8. transamiga.library/CloseBBSLine
  9. transamiga.library/ConAbortRead
  10. transamiga.library/ConCheckRead
  11. transamiga.library/ConQueueRead
  12. transamiga.library/DropDTR
  13. transamiga.library/FixString
  14. transamiga.library/FreeDriveSpace
  15. transamiga.library/LogEntry
  16. transamiga.library/NewBBSLine
  17. transamiga.library/ObtainLine
  18. transamiga.library/OutStr
  19. transamiga.library/PostNodeMsg
  20. transamiga.library/RaiseDTR
  21. transamiga.library/ReleaseLine
  22. transamiga.library/SaveMsgText
  23. transamiga.library/SerFlush
  24. transamiga.library/SerQuery
  25. transamiga.library/SerReadChar
  26. transamiga.library/SerReadData
  27. transamiga.library/SerWrite
  28. transamiga.library/SerWriteLen
  29. transamiga.library/SetSerParams
  30. transamiga.library/Notes
  31.  
  32.  
  33. transamiga.library/ANSIWrite                   transamiga.library/ANSIWrite
  34.  
  35.     NAME
  36.       ANSIWrite  - Writes a string, converting ANSI codes.
  37.  
  38.     SYNOPSIS
  39.       VOID ANSIWrite(struct BBSLine *line, char *ch);
  40.       -6c           d1                    a0
  41.     
  42.     FUNCTION
  43.       Writes the string to the terminal window.  This provides
  44.       high-powered ANSI emulation, capable of handling most Amiga and IBM
  45.       ANSI codes, including 16-colour ANSI.  This ANSI emulation is
  46.       significantly faster than the console.device with cursor on, and
  47.       about the same speed as the console.device with cursor off.  It
  48.       properly adjusts to different fonts sizes, system fonts and window
  49.       sizes.  It does not update the position of the cursor sprite.
  50.  
  51.  
  52. transamiga.library/BBSCmd                           transamiga.library/BBSCmd
  53.  
  54.     NAME
  55.       BBSCmd  - Send an ARexx message to a line
  56.     
  57.     SYNOPSIS
  58.       int BBSCmd(int linenum, char *cmd, char *buf);
  59.       -102       d0           a0         a1
  60.  
  61.     FUNCTION
  62.       Sends an ARexx command to a BBS line currently executing an ARexx
  63.       macro.  The result code of that command is returned, and any string
  64.       info returned is copied into the buffer pointed to by buf.  Any
  65.       ARexx command that TransAmiga normally understands may be sent, but
  66.       you must be careful only to use this function when you know that
  67.       TransAmiga is going to be listening to its ARexx port.  Normally,
  68.       only programmes actually started from within an ARexx macro using
  69.       "address command ..." will use this function.
  70.  
  71.       Note that though you could perform all I/O simply bby sending ARexx
  72.       commands.  However, this is not recommended for reasons of speed. 
  73.       For example, you will find it significantly faster to use
  74.       ANSIWrite() and SerWrite() to send text than using the SEND ARexx
  75.       command via BBSCmd().  For more involved I/O, such as displaying a
  76.       text file, you will however probably prefer to use send ARexx
  77.       commands.
  78.  
  79.     EXAMPLE
  80.       You must also be sure that the command sent is as TransAmiga expects
  81.       to see it.  For example, while in ARexx you might say:
  82.  
  83.         textpath='BBS:Text/'
  84.         sendfile textpath'MyFile'
  85.  
  86.       But TransAmiga will actually see this as:
  87.  
  88.         SENDFILE BBS:Text/MyFile
  89.  
  90.       As ARexx will capitalize the command, expand all variables and
  91.       remove quotation marks.  So to issue this command with BBSCmd(),
  92.       you would use:
  93.  
  94.         rc=BBSCmd(bbsline,"SENDFILE BBS:Text/MyFile",buf);
  95.  
  96.       Be careful with commands like PROMPT, where TransAmiga still expect
  97.       to see some quotation marks (see the TransAmiga.Doc for info on
  98.       this).
  99.  
  100.  
  101. transamiga.library/BBSLineInfo               transamiga.library/BBSLineInfo
  102.  
  103.     NAME
  104.       BBSLineInfo  - Returns the BBS line structure of a line number
  105.     
  106.     SYNOPSIS
  107.       ULONG BBSLineInfo(int linenum);
  108.       -42               d1
  109.  
  110.     FUNCTION
  111.       Returns the address of a BBSLine structure for the line number asked
  112.       for, or NULL if a line has not been opened under that number. 
  113.       This function should only be used when no I/O needs to be done
  114.       through the line asked for.  For all but the most simplest of tasks,
  115.       use ObtainLine()/ReleaseLine() instead.
  116.  
  117.  
  118. transamiga.library/CheckCarrier             transamiga.library/CheckCarrier
  119.  
  120.     NAME
  121.       CheckCarrier  - Determines if carrier is present
  122.     
  123.     SYNOPSIS
  124.        int CheckCarrier(struct BBSLine *line);
  125.        -4e              d1
  126.     
  127.     FUNCTION
  128.       Returns TRUE if carrier is present, or FALSE if it is not.  It will
  129.       also return TRUE if there is no serial device for that line, and if
  130.       DTR is low.
  131.  
  132.  
  133. transamiga.library/CheckLock                   transamiga.library/CheckLock
  134.  
  135.     NAME
  136.       CheckLock  - See if something is locked.
  137.     
  138.     SYNOPSIS
  139.       int CheckLock(int what);
  140.       -84           d1
  141.     
  142.     FUNCTION
  143.       Returns either TRUE or FALSE depending on whether the resources
  144.       asked for is locked.  See the header files for possible values of
  145.       what.
  146.  
  147.     BUGS
  148.       The value returned will only be meaningful if a copy of TransAmiga
  149.       is currently running.
  150.  
  151.  
  152. transamiga.library/CloseBBSLine             transamiga.library/CloseBBSLine
  153.  
  154.     NAME
  155.       CloseBBSLine  - De-initializes a BBS line
  156.     
  157.     SYNOPSIS
  158.       VOID CloseBBSLine(struct BBSLine *line);
  159.       -3c               d1
  160.     
  161.     FUNCTION
  162.       Releases all resources that were opened when NewBBSLine() was called. 
  163.       Each call you make to NewBBSLine() should have a matching
  164.       CloseBBSLine() call to close down.
  165.  
  166.  
  167. transamiga.library/ConAbortRead             transamiga.library/ConAbortRead
  168.  
  169.     NAME
  170.       ConAbortRead  - Aborts the read request
  171.     
  172.     SYNOPSIS
  173.       VOID ConAbortRead(struct BBSLine *line);
  174.       -7e               d1
  175.  
  176.     FUNCTION
  177.       Does an AbortIO() of the console read request, if one is still
  178.       pending.  If there isn't, it simply does nothing, so it is always
  179.       safe to call.
  180.  
  181.     EXAMPLE
  182.       ConQueueRead(), ConCheckRead() and ConAbortRead() were all designed
  183.       specifically for TransAmiga's needs, and therefore may not be suited
  184.       to your applications.  However, this is typically how they would be
  185.       used:
  186.  
  187.       First, make sure there are no outstanding requests:
  188.  
  189.         ConAbortRead(line);
  190.         ConQueueRead(line,ch);
  191.  
  192.       Then, to check if a key has been pressed, call queue the read with
  193.       ConQueueRead() (note that reads can be aborted by the BBS when you
  194.       don't expect it, so you should call ConQueueRead() often), then
  195.       ConCheckRead() to see if it says a character has been entered.  If it
  196.       does, double-check this by seeing if the character is non-zero.  If it
  197.       is, copy the character out of the buffer and queue up a new read:
  198.  
  199.         ConQueueRead(line,ch);
  200.         if (ConCheckRead(line)==1)
  201.         {
  202.             if (ch[0]!=0)
  203.             {
  204.                 c=ch[0];
  205.                 ConQueueRead(line,ch);
  206.             }
  207.         }
  208.  
  209.       Finally, before your programme exits, be sure to call ConAbortRead()
  210.       so no outstanding requests are still pending:
  211.  
  212.         ConAbortRead(line);
  213.  
  214.  
  215. transamiga.library/ConCheckRead             transamiga.library/ConCheckRead
  216.  
  217.     NAME
  218.       ConCheckRead  - Checks if a character has been received
  219.     
  220.     SYNOPSIS
  221.       int ConCheckRead(struct BBSLine *line);
  222.       -78              d1
  223.  
  224.     FUNCTION
  225.       Checks if the read request has completed and returns either 0 (if it
  226.       has not) or 1 (if it has).  The character will be in the buffer you
  227.       passed to ConQueueRead().
  228.  
  229.       This function will also update the position of the cursor in your
  230.       window if the window is active.
  231.  
  232.     BUGS
  233.       Sometimes ConCheckRead() will say that a character has arrived, but
  234.       your buffer will contain 0.  Your input routine should therefore
  235.       furthur check to make sure a non-zero value is in your character
  236.       buffer.
  237.  
  238.     EXAMPLE
  239.       See ConAbortRead().
  240.  
  241.  
  242. transamiga.library/ConQueueRead             transamiga.library/ConQueueRead
  243.  
  244.     NAME
  245.       ConQueueRead  - Queues a character read from the console.device
  246.  
  247.     SYNOPSIS
  248.       VOID ConQueueRead(struct BBSLine *line, char *ch);
  249.       -72               d1                    a0
  250.     
  251.     FUNCTION
  252.       Starts up an asynchronous read of one character from the
  253.       console.device.  The character will be placed in the location
  254.       pointed to by ch.  Multiple read-requests can not be queued up
  255.       simultaneously, i.e. if a request is already queued, ConQueueRead
  256.       will do nothing.
  257.  
  258.     EXAMPLE
  259.       See ConAbortRead().
  260.  
  261.  
  262. transamiga.library/DropDTR                       transamiga.library/DropDTR
  263.  
  264.     NAME
  265.       DropDTR  - Lowers serial DTR
  266.     
  267.     SYNOPSIS
  268.       VOID DropDTR(struct BBSLine *line);
  269.       -8a          d1
  270.     
  271.     FUNCTION
  272.       Drops DTR on the specified line's serial device.  When DTR is low,
  273.       any attempts to do any serial I/O will simply result in nothing
  274.       happening.
  275.  
  276.     BUGS
  277.       There is no easy way of dropping DTR on the Amiga, other than to
  278.       close all instances of the unit of the serial device in use.  This
  279.       function will close the serial device that TransAmiga opened (if you
  280.       have direct access to the BBSLine structure) or the serial device
  281.       opened when you ObtainLine()'ed a BBSLine structure.  It can't do
  282.       anything about others that have the serial device open (such as a
  283.       frontend mailer), so if there are such programmes running, DTR will
  284.       not be dropped.
  285.  
  286.  
  287. transamiga.library/FixString                   transamiga.library/FixString
  288.  
  289.     NAME
  290.       FixString  - Fixes the capatilization of a string
  291.     
  292.     SYNOPSIS
  293.       void FixString(char *name)
  294.       -f0            a0
  295.     
  296.     FUNCTION
  297.       Tries to fix the capitilization of someone's name.  The first
  298.       character, and every character after any punctuation will be
  299.       capitalized, all other characters will be in lower-case.  This can
  300.       be useful as TransAmiga stores user names all in capitals.
  301.       
  302.       FixString now also nows about names beginning with 'Mac' and 'Mc',
  303.       in which cases the next letter after them will be capitalized, and
  304.       it also knows about 'de' by itself, in which case the d will be
  305.       lowercase.
  306.  
  307.  
  308. transamiga.library/FreeDriveSpace         transamiga.library/FreeDriveSpace
  309.  
  310.     NAME
  311.       FreeDriveSpace  - returns the number of kilobytes free on a drive.
  312.     
  313.     SYNOPSIS
  314.       LONG FreeDriveSpace(char *dev);
  315.       -30            a0
  316.     
  317.     FUNCTION
  318.       Returns the number of free kilobytes on dev.  Note that dev doesn't
  319.       actually have to be the name of a physical device, it can be a
  320.       directory or an assignment, and the number of free kilobytes on the
  321.       device on which that directory or assignment resides will be
  322.       returned.
  323.  
  324.  
  325. transamiga.library/LogEntry                       transamiga.library/LogEntry
  326.  
  327.     NAME
  328.       LogEntry  - Add a formatted log entry to the specified log file.
  329.     
  330.     SYNOPSIS
  331.       VOID LogEntry(char *symbol, char *str, char *logfile);
  332.       -2a           d1           a0         a1
  333.     
  334.     FUNCTION
  335.       Appends str to logfile, with symbol as the identifier.  It is
  336.       formatted with the identifier first, followed by the date and time
  337.       then the log string.  If the file does not exist, it creates a new
  338.       one.  Symbol should be a one character string.
  339.  
  340.  
  341. transamiga.library/NewBBSLine                 transamiga.library/NewBBSLine
  342.  
  343.     NAME
  344.       NewBBSLine  - Sets up a new line for the BBS.
  345.     
  346.     SYNOPSIS
  347.       int NewBBSLine(struct BBSLine *line);
  348.       -36            d1
  349.     
  350.     FUNCTION
  351.       Does all the necessary setup for a new BBS line, given a properly
  352.       initialized BBSLine struct.  The only fields of this structure that
  353.       need to be set are bl_Number and bl_Window.  If no font name and
  354.       size is given, no font will be set for your window.  If no serial
  355.       device name is given, then no serial device will be open, and all
  356.       serial I/O functions for that line will simply do nothing.  If you
  357.       do not set bl_Screen, then the Workbench screen will be used (or the
  358.       default public screen for those running Release 2).  You should set
  359.       the bl_Status field to something meaningful.
  360.  
  361.       See transamiga.h for more information on specific fields in the
  362.       BBSLine structure and for return codes.
  363.  
  364.       Nothing other than TransAmiga itself should ever actually have a
  365.       need for this function, as doors spawned from the BBS do not setup
  366.       their own line.
  367.  
  368.  
  369. transamiga.library/ObtainLine                   transamiga.library/ObtainLine
  370.  
  371.     NAME
  372.       ObtainLine  - Obtain access to a BBSLine structure
  373.     
  374.     SYNOPSIS
  375.       LONG ObtainLine(LONG linenum, struct BBSLine *linebuf);
  376.       -114            d1            a0
  377.  
  378.     FUNCTION
  379.       Gains access to the line asked for.  A copy is made of the BBSLine
  380.       structure, and is put into the buffer pointed to by linebuf.  An
  381.       error code is returned (see transamiga.h) or 0 if there was no
  382.       error.
  383.  
  384.     EXAMPLE
  385.       struct BBSLine line_buf;
  386.       LONG ret,bbsline=0;
  387.  
  388.       ret=ObtainLine(bbsline,&line_buf);
  389.       ...
  390.       ReleaseLine(&line_buf);
  391.  
  392.  
  393. transamiga.library/OutStr                            transamiga.library/OuStr
  394.  
  395.     NAME
  396.       OutStr  - Simple unbuffered text output to stdout.
  397.    
  398.        SYNOPSIS
  399.       VOID OutStr(char *str);
  400.       -24         a0
  401.     
  402.     FUNCTION
  403.       Simply prints the supplied string to Output().  Absolutely nothing
  404.       fancy is done, just a quick way to ouput a string.
  405.  
  406.  
  407. transamiga.library/PostNodeMsg                transamiga.library/PostNodeMsg
  408.  
  409.     NAME
  410.       PostNodeMsg  - Sends a message to another line.
  411.     
  412.     SYNOPSIS
  413.       void PostNodeMsg(struct BBSLine *line, int linenum, char *msg)
  414.       -c6              d1
  415.     
  416.     FUNCTION
  417.       Sends an online message to the indicated line number.  If linenum is
  418.       greater than 100, then the message will be broadcast to all lines
  419.       except the current one.  Passing the BBSLine structure of the current
  420.       line (or a copy thereof) is optional, but recommended if possible.
  421.       For example, a door programme SHOULD pass it, while an external
  422.       programme talking to the BBS wouldn't be able to so it shouldn't.
  423.  
  424.     BUGS
  425.       In versions of TransAmiga previous to v1.11, a completely different
  426.       method of passing messages was used that involved the setting of the
  427.       bl_Message field in the BBSLine structure.  This method was poor,
  428.       and that's why it was replaced, however, some applications may have
  429.       depended on this and will therefore break under v1.11 and above.
  430.  
  431.  
  432. transamiga.library/RaiseDTR                     transamiga.library/RaiseDTR
  433.  
  434.     NAME
  435.       RaiseDTR  - Raises serial DTR
  436.  
  437.     SYNOPSIS
  438.       VOID RaiseDTR(struct BBSLine *line);
  439.       -90           d1
  440.     
  441.     FUNCTION
  442.       Raises the DTR for the serial device of the specified line.  If the
  443.       line isn't using serial.device, then it will just re-OpenDevice()
  444.       the read and write requests.
  445.  
  446.  
  447. transamiga.library/ReleaseLine                 transamiga.library/ReleaseLine
  448.  
  449.     NAME
  450.       ReleaseLine  - Release an obtained line
  451.     
  452.     SYNOPSIS
  453.       VOID ReleaseLine(struct BBSLine *line);
  454.       -11a             a0
  455.  
  456.     FUNCTION
  457.       Relinquishes control over a line that you have obtained using
  458.       ObtainLine().  Every call to ObtainLine() must be matched by a call
  459.       to ReleaseLine().  Once you have called this function, you may no
  460.       longer use the BBSLine structure you've obtained.
  461.  
  462.  
  463. transamiga.library/SaveMsgText                 transamiga.library/SaveMsgText
  464.  
  465.     NAME
  466.       SaveMsgText  - Save the text of a message to a file
  467.     
  468.     SYNOPSIS
  469.       int SaveMsgText(char *infile, char *outfile, LONG msgnum, LONG type,
  470.       -108            a0            a1             d0           d1
  471.                       LONG marg, struct MsgHeader *header)
  472.                       d2         a2    
  473.     FUNCTION
  474.       Saves an FTS-0001 message file, given by infile and msgnum, to the
  475.       given outfile.  If outfile exists, the text will be appended to it.
  476.       It will be formatted to fit into a margin of marg.  header is not
  477.       currently used, but you MUST pass 0 in the meantime.  Type allows
  478.       you to specify what the output will look like, see transamiga.h for
  479.       the definitions of the various flags.
  480.  
  481.  
  482. transamiga.library/SerFlush                     transamiga.library/SerFlush
  483.  
  484.     NAME
  485.       SerFlush  - Flushes the serial device's input buffer
  486.  
  487.     SYNOPSIS
  488.       VOID SerFlush(struct BBSLine *line);
  489.       -66           d1
  490.     
  491.     FUNCTION
  492.       Does a CMD_CLEAR on the lines serial read request.
  493.  
  494.  
  495. transamiga.library/SerQuery                     transamiga.library/SerQuery
  496.  
  497.     NAME
  498.       SerQuery  - Query how many characters the serial device has waiting
  499.     
  500.     SYNOPSIS
  501.       ULONG SerQuery(struct BBSLine *line);
  502.       -ba            d1
  503.     
  504.     FUNCTION
  505.       Returns the number of characters waiting to be read from the serial
  506.       device of the given line, but doesn't actually read any.
  507.  
  508.  
  509. transamiga.library/SerReadChar               transamiga.library/SerReadChar
  510.  
  511.     NAME
  512.       SerReadChar  - Reads a character from the serial port
  513.  
  514.     SYNOPSIS
  515.       LONG SerReadChar(struct BBSLine *line, char *ch);
  516.       -60              d1                    a0
  517.     
  518.     FUNCTION
  519.       Reads a single character from the serial port if there is one
  520.       waiting, and places it in the buffer *ch.  Returns the number of
  521.       characters read (either 0 or 1).  Always returns 0 if there is no
  522.       serial device open or DTR is low.
  523.  
  524.  
  525. transamiga.library/SerReadData               transamiga.library/SerReadData
  526.  
  527.     NAME
  528.       SerReadData  - Gets all waiting characters from the serial port
  529.     
  530.     SYNOPSIS
  531.       LONG SerReadData(struct BBSLine *line, char *ch);
  532.       -5a              d1                    a0
  533.     
  534.     FUNCTION
  535.       Reads all characters waiting at the serial port into the buffer *ch.
  536.       Returns the number of characters actually read.  Always returns 0 if
  537.       there is no serial device open or DTR is low.
  538.  
  539.  
  540. transamiga.library/SerWrite                     transamiga.library/SerWrite
  541.  
  542.     NAME
  543.       SerWrite  - Outputs a string to the serial port
  544.     
  545.     SYNOPSIS
  546.       VOID SerWrite(struct BBSLine *line, char *ch);
  547.       -54           d1                    a0
  548.     
  549.     FUNCTION
  550.       Simply sends the specified string to the given line's serial port.
  551.  
  552.  
  553. transamiga.library/SerWriteLen               transamiga.library/SerWriteLen
  554.  
  555.     NAME
  556.       SerWriteLen  - Outputs a string to the serial port
  557.     
  558.     SYNOPSIS
  559.       VOID SerWriteLen(struct BBSLine *line, char *ch, ULONG len);
  560.       -ae              d1                    a0        a1
  561.                        
  562.     FUNCTION
  563.       Simply sends the specified string of the given length to the line's
  564.       serial port.
  565.  
  566.  
  567. transamiga.library/SetSerParams             transamiga.library/SetSerParams
  568.  
  569.     NAME
  570.       SetSerParams  - Changes the baud rate for a line
  571.     
  572.     SYNOPSIS
  573.       VOID SetSerParams(struct BBSLine *line, ULONG baud);
  574.       -48               d1                    d2
  575.     
  576.     FUNCTION
  577.       Adjusts the baud rate of the serial device for the line given.  Safe
  578.       to call if the serial device is not open.
  579.  
  580.  
  581. transamiga.library/Notes                           transamiga.library/Notes
  582.  
  583.     This library is still under development, so there are functions still to
  584.     be added, and existing functions may be changed.  Also, there are a
  585.     few private functions that are not documented here (since they're
  586.     private).
  587.  
  588.